#include <stdio.h>
#include <time.h>
#include <stdlib.h>

int contains(int arr[], int len, int num);

int main(int argc, char const *argv[])
{
    /* 将98位100以内的数赋值为一个数组，并找出那两个100以内的数不在该数组中 */
    srand(time(NULL));
    int arr[98] = {0};
    int len = 98;

    for (int i = 0; i < len;)
    {
        int num = rand() % 100 + 1;
        if (!contains(arr, len, num))
        {
            arr[i] = num;
            i++;
        }
    }
    // for (int i = 0; i < len; i++)
    // {
    //     int tamp = arr[i];
    //     printf("%d \n",tamp);
    // }
    printf("不在该数组中的两个数是：");
    for (int i = 1; i <= 100; i++)
    {
        if (!contains(arr, len, i))
        {
            printf("%d ", i);
        }
    }

    return 0;
}

// 数组去重
int contains(int arr[], int len, int num)
{
    for (int i = 0; i < len; i++)
    {
        if (arr[i] == num)
        {
            return 1;
        }
    }
    return 0;
}
